# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=libfbclient

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.5.2.26540
pkgrel=1
pkgdesc="Firebird client libraries (mingw-w64)"
arch=('any')
url="http://firebirdsql.org"
license=('GPL')
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")
depends=("${MINGW_PACKAGE_PREFIX}-crt")
options=('!strip' 'staticlibs')
source=("http://sourceforge.net/projects/firebird/files/firebird-win32/2.5.2-Release/Firebird-2.5.2.26540-0_Win32.zip"
        "http://sourceforge.net/projects/firebird/files/firebird-win64/2.5.2-Release/Firebird-2.5.2.26540-0_x64.zip")
sha256sums=('4cb43b9b1906418980622a18c313a35196b896821fbaeb61742971f79f32b951'
            'b7074980e4dcd4880ac0385ed272bb40d1eb33b4f047c1cb10bb42fefdb864f0')
noextract=("Firebird-2.5.2.26540-0_Win32.zip" "Firebird-2.5.2.26540-0_x64.zip")

prepare() {
  mkdir ${srcdir}/${MINGW_CHOST}
  case ${MINGW_CHOST} in
    i686*)
      [ -d $srcdir/$pkgname-$_ver ] || /bin/bsdtar -xf ${startdir}/Firebird-2.5.2.26540-0_Win32.zip -C ${srcdir}/${MINGW_CHOST}
    ;;
    x86_64*)
      [ -d $srcdir/$pkgname-$_ver ] || /bin/bsdtar -xf ${startdir}/Firebird-2.5.2.26540-0_x64.zip -C ${srcdir}/${MINGW_CHOST}
    ;;
  esac
}

package() {
    cd "${srcdir}/${MINGW_CHOST}"
    mkdir -p "${pkgdir}${MINGW_PREFIX}/"{bin,include,lib}
    cp -R include "${pkgdir}${MINGW_PREFIX}"
    install -Dm644 lib/fbclient_ms.lib "${pkgdir}${MINGW_PREFIX}/lib/fbclient_ms.lib"
    install -Dm644 bin/fbclient.dll "${pkgdir}${MINGW_PREFIX}/bin/fbclient.dll"
}
